<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
		<title>砸金蛋游戏</title>
		<link rel="stylesheet" href="__PUBLIC__/Home/mystatic/css/style.css" />
	</head>

	<body class="gamebody">
		<div class="play">
			<img src="__PUBLIC__/Home/mystatic/img/egg_bg.png" class="bg">
			<div class="egg">
				<a href="javascript:void(0);" onclick="goPrize();"></a>
				<a href="javascript:void(0);" onclick="goPrize();"></a>
				<a href="javascript:void(0);" onclick="goPrize();"></a>
			</div>
			<img src="__PUBLIC__/Home/mystatic/img/hammer.png" class="hammer">
		</div>
		<div class="game_intro">
			<hr>
			<!--<div>
				<h2>活动规则</h2>
				<p>用户通过分享参赛选手的作品并完成投票即可获得{$vote_data['share_getnum']}次抽奖机会，每日投票上限为{$vote_data['day_num']}次，奖品礼券由平台自动发放至抽奖账号，用户登录Tronker APP进入“商城”-“活动礼品兑换专区”领取使用。</p>
				&lt;!&ndash; <p>抽奖机会可通过以下两种方式获得：<br> 参加投票可获得抽奖机会，每个注册ID每天仅有{$vote_data['day_num']}次投票机会；
					<br> 每天成功邀请{$usernum['share_voteuser']}个好友参与投票，分享者可获得{$vote_data['share_getnum']}次抽奖机会；
				</p>
				<p>注：每个用户每天最多能使用{$lottery_data['most_num']}次抽奖机会，当天{$lottery_data['most_num']}次抽奖机会用完后，剩余抽奖机会不清0，可累计至第二天继续抽奖</p> &ndash;&gt;
				<p>活动周期：{$time['start_time']|date="Y-m-d",###} 至 {$time['end_time']|date="Y-m-d",###}<br> 活动最终解释权归活动主办方所有
				</p>
			</div>
			<hr>-->
			<div>
				<h2>你剩余抽奖次数</h2>
				<p>{$luckdraw_num}次</p>
			</div>
		<!-- 	<div>
				<h2>你今天的可抽奖次数</h2>
				<p>{$surplus_num}次</p>
			</div> -->
			<hr>
			<!--<div>
				<h2>奖项设置</h2>
				<p>随机抽取奖励有：
				{foreach name="prize_data" item="prize"}
				    <br> {$prize['prize_name']}
				{/foreach}
				</p>
			</div>
			<hr>-->
			<div>
				<h2>我的奖品</h2>
				{if condition="$user_prize[0] neq ''"}
				{foreach name="user_prize" item="prize"}
				<div style="clear: both;color:#fff;">
					<p style="float: left;">{$prize['prize_name']}</p>
				</div>
				{/foreach}
				{else/}
				<p>暂未获得奖品</p>
				{/if}
				{if condition="$user_prize[0] neq ''"}
				<a onclick="getPrize()" style="float: right; margin-bottom: 10px;color: #fff;border: 1px solid #fff;padding:2px 15px;background: none;" >领取奖品</a>
				{/if}
			</div>
				<style type="text/css">
			.middle{overflow: hidden;height: 100px;}
				#scroll div{maring:0;padding:0;}
				#scroll	p{margin: 0;padding: 0;}
				.box div{line-height: 28px;font-size: 14px;}	
				#scroll span{width: 45%;display: inline-block;overflow: hidden;white-space: nowrap;text-overflow : ellipsis; text-align: center;}
				#scroll p{height: 28px}
				.title span{width: 45%;display: inline-block;overflow: hidden;white-space: nowrap;text-overflow : ellipsis;text-align: center;}
				</style>
			<hr>
			<div>
				<h2>中奖记录</h2>
				{if condition="$all_user_prize[0] neq ''"}
				<div class="title" style="padding:0;color:#fff;"><span>奖品</span><span>用户</span></div>
				<div class=" middle" id="scroll" style="padding:0;margin:0;">
					<div class="box">	
						<div id="scroll1">
							{foreach name="all_user_prize" item="all_prize"}
							<p><span>{$all_prize['prize_name']}</span> <span>{$all_prize['username']}</span></p>
							{/foreach}
						</div>
						<div id="scroll2"></div>
					</div>
				</div>
				{else/}
				<p>暂未有中奖记录</p>
				{/if}
			</div>
			<hr>
		</div>
	</body>
	<script>
					var scroll=document.getElementById("scroll");
					var scroll1=document.getElementById("scroll1");
					var scroll2=document.getElementById("scroll2");
					var pLen=document.getElementById("scroll1").getElementsByTagName("p");
					var len=pLen.length;
					scroll1.style.height=scroll2.style.height=len*28+"px";
					scroll2.innerHTML=scroll1.innerHTML;
					function scrollFun(){
						if(scroll.scrollTop-scroll1.offsetHeight>=0){
							scroll.scrollTop-=scroll1.offsetHeight;
						}else{
							scroll.scrollTop++;
						}
					}
					var intervalFun=setInterval(scrollFun,60);
					scroll.onmouseout=function(){
						intervalFun=setInterval(scrollFun,60)
					}
					scroll.onmouseover=function(){
						clearInterval(intervalFun);
					}

				</script>
	<script type="text/javascript" src="__PUBLIC__/Home/mystatic/js/jquery-2.1.0.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Home/mystatic/js/myscript.js"></script>
	<script type="text/javascript">
		//1秒后跳去抽奖
		function goPrize(){
			setTimeout(function(){								
				window.location.href="__URL__/prizeDraw";
			},1000);
		}
	</script>
</html>

<script type="text/javascript">
	/**
	 * 领奖
     * @param id
     */
	function getPrize()
	{
        var url ="__URL__/getPrize";
            if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i))
            {
            	//alert('iPhone');
                window.location.href = "iOSTronkerApp://tab_name=mall";//ios app协议
                window.setTimeout(function()
                {
                    window.location.href = url;  //跳转领奖页面
                }, 2000)
            }
            else if(navigator.userAgent.match(/android/i))
            {
            	//alert('android');
                window.location.href = "tk://tronker.com/home?tab_name=mall";//android app协议
                window.setTimeout(function() {
                    window.location.href = url;    //跳转领奖页面
                }, 2000)
            }
    }
</script>
<script type="text/javascript" src="__PUBLIC__/Home/mystatic/js/bottom.js"></script>